home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 152 / rscfix.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-06-21  |  2.8 KB  |  147 lines

  1. /*    RSCFIX.C    09/16/86        Ric Clayton    */
  2. /*    STCREATE.c    04/20/85        ATARI        */
  3. /*    RSCREATE.C    05/18/84 - 11/01/84    LKW        */
  4. /*    Fix something    12/10/84 - 12/10/84    Derek Mui    */
  5. /*    Fix the  size    12/17/84                */
  6. /*    For ST        04/20/85        Derek Mui    */
  7. /*    For code resident rsc 09/16/86        Ric Clayton    */
  8.  
  9. #define adj(xywh, siz)    (siz * (xywh & 0x00FF) + (xywh >> 8))
  10.  
  11. rsc_fix()
  12. {
  13.     fix_trindex();
  14.     fix_objects();
  15.     fix_tedinfo();
  16.     fix_iconblk();
  17.     fix_bitblk();
  18.     fix_frstr();
  19.     fix_frimg();
  20. }
  21.  
  22. fix_trindex()
  23.     {
  24.     int    test, ii;
  25.  
  26.     for (ii = 0; ii < NUM_TREE; ii++)
  27.         {
  28.         test = (int) rs_trindex[ii];
  29.         rs_trindex[ii] = (long) &rs_object[test];
  30.         }
  31.     }
  32.  
  33. fix_objects()
  34.     {
  35.     int    test, ii;
  36.     int    wchar, hchar;
  37.  
  38.     graf_handle( &wchar, &hchar, &ii, &ii );
  39.  
  40.     for (ii = 0; ii < NUM_OBS; ii++)
  41.         {
  42.         rs_object[ii].ob_x = adj(rs_object[ii].ob_x, wchar);
  43.         rs_object[ii].ob_y = adj(rs_object[ii].ob_y, hchar);
  44.         rs_object[ii].ob_width = adj(rs_object[ii].ob_width, wchar);
  45.         rs_object[ii].ob_height = adj(rs_object[ii].ob_height, hchar);
  46.         test = (int) rs_object[ii].ob_spec;
  47.         switch (rs_object[ii].ob_type) {
  48.             case G_TITLE:
  49.             case G_STRING:
  50.             case G_BUTTON:
  51.                 fix_str(&rs_object[ii].ob_spec);
  52.                 break;
  53.             case G_TEXT:
  54.             case G_BOXTEXT:
  55.             case G_FTEXT:
  56.             case G_FBOXTEXT:
  57.                 if (test != NIL)
  58.                    rs_object[ii].ob_spec = 
  59.                     (char *) &rs_tedinfo[test];
  60.                 break;
  61.             case G_ICON:
  62.                 if (test != NIL)
  63.                    rs_object[ii].ob_spec =
  64.                     (char *) &rs_iconblk[test];
  65.                 break;
  66.             case G_IMAGE:
  67.                 if (test != NIL)
  68.                    rs_object[ii].ob_spec =
  69.                     (char *) &rs_bitblk[test];
  70.                 break;
  71.             default:
  72.                 break;
  73.             }
  74.         }
  75.     }
  76.  
  77. fix_tedinfo()
  78.     {
  79.     int    ii;
  80.  
  81.     for (ii = 0; ii < NUM_TI; ii++)
  82.         {
  83.         fix_str(&rs_tedinfo[ii].te_ptext);
  84.         fix_str(&rs_tedinfo[ii].te_ptmplt);
  85.         fix_str(&rs_tedinfo[ii].te_pvalid);
  86.         }
  87.     }
  88.  
  89. fix_frstr()
  90.     {
  91.     int    ii;
  92.  
  93.     for (ii = 0; ii < NUM_FRSTR; ii++)
  94.         fix_str(&rs_frstr[ii]);
  95.     }
  96.  
  97. fix_str(where)
  98.     long    *where;
  99.     {
  100.     if (*where != NIL)
  101.         *where = (long) rs_strings[(int) *where];
  102.     }
  103.  
  104. fix_iconblk()
  105.     {
  106.     int    ii;
  107.  
  108.     for (ii = 0; ii < NUM_IB; ii++)
  109.         {
  110.         fix_img(&rs_iconblk[ii].ib_pmask);
  111.         fix_img(&rs_iconblk[ii].ib_pdata);
  112.         fix_str(&rs_iconblk[ii].ib_ptext);
  113.         }
  114.     }
  115.  
  116. fix_bitblk()
  117.     {
  118.     int    ii;
  119.  
  120.     for (ii = 0; ii < NUM_BB; ii++)
  121.         fix_img(&rs_bitblk[ii].bi_pdata);
  122.     }
  123.  
  124. fix_frimg()
  125.     {
  126.     int    ii;
  127.  
  128.     for (ii = 0; ii < NUM_FRIMG; ii++)
  129.         fix_bb(&rs_frimg[ii]);
  130.     }
  131.  
  132. fix_bb(where)
  133.     long    *where;
  134.     {
  135.     if (*where != NIL)
  136.         *where = (long) (char *) &rs_bitblk[(char) *where];
  137.     }
  138.     
  139. fix_img(where)
  140.     long    *where;
  141. {
  142.     if (*where != NIL)
  143.      *where = (long) (char *) rs_imdope[(int) *where].image;
  144. }
  145.  
  146. #undef adj
  147. əəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəə